﻿using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Text;
using TianShu.LicenseAuthorizer.Abstracts.Config;
using TianShu.LicenseAuthorizer.Abstracts.Service;
using TianShu.Untils;
using Volo.Abp.Modularity;
using Volo.Abp.Timing;

namespace TianShu.LicenseAuthorizer.Abstracts
{
    [DependsOn(
        typeof(TianShuUntilsModule),
        typeof(AbpTimingModule)
        )]
    public class TianShuLicenseAuthorizerAbstractsModule : AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            Configure<LicenseLoaderOptions>(opt =>
            {
                opt.Add("licenses");
            });
            base.ConfigureServices(context);
        }
        public override void OnApplicationInitialization(Volo.Abp.ApplicationInitializationContext context)
        {
            var licenseLoader = context.ServiceProvider.GetService<ILiceseLoaderService>();
            licenseLoader.GetAllLicenseAuthorizerInfo();
        }
    }
}
